/**
 * @description cooklie相关操作
 * @author 印明帝
 */

/**
  * 获取cookie
  * @method getCookie
  * @returns {String}
  */
function getCookie () {
  let cookie = document.cookie
  let cookieArr = cookie.split(';')
  return cookieArr
}
/**
 * 判断cookie是否包含传入的字段
 * @method inCookie
 * @param {String} data
 * @return {Boolean}
 */
function inCookie (data) {
  let cookieArr = getCookie()

  let result = cookieArr.filter(cookie => {
    let flag = cookie.indexOf('weibo.sid')
    if (flag !== -1) {
      return cookie
    }
  })
  // 判断cookie中是否存在该数据
  if (result.length >= 2) {
    return true
  }
  return false
}

export {
  inCookie
}
